﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:ccontrols="clr-namespace:UBConDemo.CustomControls"
                    xmlns:ubcr="http://schemas.ultimatebusinesscontrols.com/wpf/xaml/ribbon"
                    xmlns:ubcon="clr-namespace:UBConDemo">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="pack://application:,,,/UbConDemo;component/Themes/Brushes.xaml" />
    </ResourceDictionary.MergedDictionaries>
    <ubcon:UbConItemTemplateSelector x:Key="templateSelctor" />
    <ubcon:UbConItemStyleSelector x:Key="styleSelector" />

    
    
    <!--================================UbConItem Template And Style==============================================-->

    <ControlTemplate TargetType="{x:Type ccontrols:UbConItem}"
                     x:Key="{ComponentResourceKey ResourceId=DefaultUbConItemTemplate, TypeInTargetAssembly={x:Type ubcon:ResourceManager}}">
        <ubcr:RibbonChrome CornerRadius="0"
                           InnerBorderCornerRadius="0"
                           BorderThickness="0"
                           InnerBorderThickness="0"
                           RenderMouseOver="{TemplateBinding IsMouseOver}"
                           RenderPressed="{TemplateBinding IsPressed}"
                           MouseOverBackgroundBrush="{DynamicResource ResourceKey={ComponentResourceKey ResourceId=MouseOverBackgroundBrush, TypeInTargetAssembly={x:Type ubcon:ResourceManager}}}"
                           PressedBackgroundBrush="{DynamicResource ResourceKey={ComponentResourceKey ResourceId=MouseOverBackgroundBrush, TypeInTargetAssembly={x:Type ubcon:ResourceManager}}}">
            <ContentPresenter ContentSource="Content"
                              HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                              VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
        </ubcr:RibbonChrome>
    </ControlTemplate>
    
    <Style TargetType="{x:Type ccontrols:UbConItem}"
           x:Key="{x:Type ccontrols:UbConItem}">
        <Setter Property="MinHeight" Value="20"/>
        <Setter Property="MinWidth" Value="100"/>
        <Setter Property="Margin" Value="2"/>
        <Setter Property="Template"
                Value="{StaticResource ResourceKey={ComponentResourceKey ResourceId=DefaultUbConItemTemplate, TypeInTargetAssembly={x:Type ubcon:ResourceManager}}}"/>
    </Style>

    <!--================================UbConItemsControl Template And Style==============================================-->

    <ControlTemplate TargetType="{x:Type ccontrols:UbConItemsControl}"
                     x:Key="{ComponentResourceKey ResourceId=DefaultUbConItemsControlTemplate, TypeInTargetAssembly={x:Type ubcon:ResourceManager}}">
        <ccontrols:WrapPanel IsItemsHost="True"
                             HorizontalOffset="{Binding Path=HorizontalOffset, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay}"
                             ViewportWidth="{Binding Path=ViewportWidth, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay}"
                             ExtentWidth="{Binding Path=ExtentWidth, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay}"/>
        
    </ControlTemplate>

    <Style TargetType="{x:Type ccontrols:UbConItemsControl}"
           x:Key="{x:Type ccontrols:UbConItemsControl}">
        <Setter Property="ItemTemplateSelector" Value="{StaticResource ResourceKey=templateSelctor}" />
        <Setter Property="ItemContainerStyleSelector" Value="{StaticResource ResourceKey=styleSelector}"/>
        <Setter Property="Template"
                Value="{StaticResource ResourceKey={ComponentResourceKey ResourceId=DefaultUbConItemsControlTemplate, TypeInTargetAssembly={x:Type ubcon:ResourceManager}}}"/>
    </Style>
</ResourceDictionary>